package com.liang.wx.enums;

import lombok.AllArgsConstructor;

/**
 * 公众号消息类型枚举
 */
@AllArgsConstructor
public enum MessageTypeEnum {

    SUBSCRIBE("subscribe", "订阅"),
    UNSUBSCRIBE("unsubscribe", "取消订阅"),
    TEXT("text", "文本"),
    IMAGE("image", "图片"),
    VOICE("voice", "语音"),
    VIDEO("video", "视频"),
    SHORTVIDEO("shortvideo", "小视频"),
    LOCATION("location", "地理位置"),
    LINK("link", "链接"),
    EVENT("event", "事件推送");

    private String type;
    private String desc;

    public static MessageTypeEnum getByType(String type) {
        for (MessageTypeEnum messageTypeEnum : MessageTypeEnum.values()) {
            if (messageTypeEnum.type.equals(type)) {
                return messageTypeEnum;
            }
        }
        return null;
    }
}
